<?php
/**
 * +----------------------------------------------------------------------
 * | 九月科技-ztuc.cn
 * +----------------------------------------------------------------------
 *                      .::::.
 *                    .::::::::.            | AUTHOR: siyu
 *                    :::::::::::           | EMAIL: ztucke@ztuc.cn
 *                 ..:::::::::::'           | DATETIME: 2020/01/31
 *             '::::::::::::'
 *                .::::::::::
 *           '::::::::::::::..
 *                ..::::::::::::.
 *              ``::::::::::::::::
 *               ::::``:::::::::'        .:::.
 *              ::::'   ':::::'       .::::::::.
 *            .::::'      ::::     .:::::::'::::.
 *           .:::'       :::::  .:::::::::' ':::::.
 *          .::'        :::::.:::::::::'      ':::::.
 *         .::'         ::::::::::::::'         ``::::.
 *     ...:::           ::::::::::::'              ``::.
 *   ```` ':.          ':::::::::'                  ::::..
 *                      '.:::::'                    ':'````..
 * +----------------------------------------------------------------------
 */
/**
/**
 * Created by PhpStorm.
 * ClickLog: Administrator
 * Date: 2020/3/14
 * Time: 17:18
 */

namespace app\lnadmin\controller;
use app\core\InitController;
use think\facade\View;
use app\lnadmin\model\admin\Mongodb as MongodbModel;
class Mongodb extends InitController
{

    // 列表
    public function list()
    {
        return View::fetch('mongodb');
    }

    
    public function index_json($limit='15')
    {
        $list = MongodbModel::order('_id', 'desc')->paginate($limit);
        $this->result($list);
    }
    /**
     * 一键清空日志
     * @throws \think\db\exception\DbException
     */
    public function del()
    {
       $result = MongodbModel::where('_id', '>', 0)->delete();
            if ($result == true) {
            add_admin_log('del', '一键清空芒果日志');// 记录行为日志
                return $this->success('', '', '清空成功');
            } else {
                $this->error($this->errorMsg);
            }
     
    }
}